FUNCTION DAC_ResetBitOfByte :Byte
TITLE = 'DAC_ResetBitOfByte'
//
// This functionblock reset a single bit in a byte
// 
// Versionshistory:
// 1.0 Ersterstellung E.Dittmann

VERSION : '1.0'
AUTHOR  : 'Lenze'
FAMILY  : 'DAC'
NAME : 'xResetby'
KNOW_HOW_PROTECT

CONST
    dat := B#16#1;
END_CONST

VAR_INPUT
    byInput:                    BYTE;                               // Inputbyte
    byBitNr:                    BYTE;                               // Bitnumber (Range 0 - 7)
END_VAR

VAR
END_VAR

BEGIN
IF (BYTE_TO_INT(byBitNr) >= 0) AND (BYTE_TO_INT(byBitNr) <8) THEN
    DAC_ResetBitOfByte := byInput AND (NOT SHL(IN:=dat,N:=BYTE_TO_INT(byBitNr)));
END_IF;

END_FUNCTION
